package javanlp;

//import OpenNLP.Span;
import java.io.*;
import opennlp.tools.namefind.*;
import opennlp.tools.util.Span;

public class findName{	
public static void main(String[] args) throws IOException {
    String fld = "C:/Users/lenovolap/Dropbox/java/NLP.models/";
    String trainedModel = fld+"en-ner-person.zip";
    TokenNameFinderModel model;
    try (InputStream is = new FileInputStream(trainedModel)) {
            model = new TokenNameFinderModel(is);
        }
    NameFinderME nmFinder = new NameFinderME(model);
    String[] st = new String[]{"Mike", "Smith",  "is",
	"a",  "good",   "person","Jeff","Xiangyang","is","Tom"  };
    Span nameSpan[] = nmFinder.find(st);
    
    for(Span s: nameSpan){
	System.out.println(s.toString());
        }
    }
}